<template>
  <div class="dx-detail-container">
    <div class="dx-header-container">
      <div>
        <i class="dx-layer" /><span>
          {{ detailData.zhName }}-监测表单id= {{ detailID }}</span
        >
      </div>
      <div><i class="el-icon-close" @click="closeContainer" /></div>
    </div>
    <div v-if="true" class="dx-body-container dx-form-container">
      <component v-if="componentName" :is="componentName" />
    </div>
    <div
      v-else
      style="width: 100%; height: 200px; text-align: center; line-height: 200px"
    >
      暂无数据
    </div>
  </div>
</template>
<script>
import DataOptions from "./dataOptions";
export default {
  name: "DataForm",
  data() {
    return {
      detailData: {},
      detailType: "",
      detailID: "",
      componentName: "",
    };
  },
  mounted() {
    this.detailType = this.$route.params.type || {};
    this.detailID = this.$route.params.id || null;
    this.detailData = DataOptions.fieldlabel[this.detailType];
    this.componentName = this.detailData.components.form;
  },
  methods: {
    closeContainer() {
      this.$router.go(-1);
    },
  },
};
</script>

<style>
.dx-form-container .el-form-item__label,
.dx-form-container .el-radio,
.dx-form-container .el-checkbox,
.dx-form-container .el-input__prefix,
.dx-form-container .el-input__inner {
  color: #fff;
}

.dx-form-container .el-input__inner,
.dx-form-container .el-textarea__inner {
  background-color: transparent !important;
}
</style>
<style lang="scss" scoped>
.dx-form-container {
  padding: 15px 20px;
}
</style>
